package com.jt.www.enums.issue;

import java.util.ArrayList;
import java.util.List;

/**
 * ifCode与proCode对应关系
 */
public enum IssueEnum {
    CODE_1("20190516002", "19PR372456", "山东省校（园）方责任保险项目"),//山东省校（园）方责任保险项目
    CODE_2("20190515026", "19PR403423", "学生安全责任保险"),//学生安全责任保险
    CODE_3("20190729001", "19PR941489", "徐州市中小学幼儿园学生专属保险"),//徐州市中小学幼儿园学生专属保险
    CODE_4("20190528002", "19PR799624", "华泰财险成长护航重疾险"),//华泰财险成长护航重疾险
    CODE_5("20190528003", "19PR211524", "华泰财险安康保护伞"),//华泰财险安康保护伞
    CODE_6("20190528001", "19PR352395", "泰然无忧百万医疗"),//泰然无忧百万医疗
    CODE_7("20200312001", "20PR263503", "云南学平险"),//云南学平险获取支付地址
    CODE_70("20200312002", "20PR263503", "云南学平险"),//云南学平险
    CODE_9("20190802002", "19PR701524", "校园食品安全责任保险"),//校园食品安全责任保险
    CODE_10("2019051600640000", "19PR452292", "云南非九-校方综合防范保障保险"),//云南非九-校方综合防范保障保险
    CODE_11("2019051600630000", "19PR467834", "南非九-教职员工校方责任保险"),//云南非九-教职员工校方责任保险
    CODE_12("2019051600620000", "19PR233356", "云南非九-校园食品安全责任保险"),//云南非九-校园食品安全责任保险
    CODE_13("2019051600610000", "19PR534934", "云南非九-云南省校方责任保险"),//云南非九-云南省校方责任保险
    CODE_14("201905150021", "19PR789827", "全国职业院校学生实习责任保险"),//全国职业院校学生实习责任保险
    CODE_15("201905150022", "19PR961660", "校方责任保险"),//校方责任保险
    //CODE_16("20190805001", "19PR979745", "济宁学平险"),//济宁学平险
    CODE_16("202008241457160", "19PR979745", "济宁学平险"),//济宁学平险（线下批量录单）
    CODE_17("20190515006", "19PR611048", "阳光财产安责保护伞"),//阳光财产安责保护伞
    CODE_18("201905180011", "19PR789827", "实责（大地）"),//实责（大地）
    CODE_19("201905180012", "19PR961660", "校责（大地）"),//校责（大地）
    CODE_20("20190802001", "19PR701524", "食品险（太平）"),//食品险（太平）
    CODE_21("201907260171", "19PR789827", "实责（太平）"),//实责（太平）
    CODE_22("201907260172", "19PR961660", "校责（太平）"),//实责（太平）
    CODE_23("20190807001", "19PR701524", "校园食品安全责任保险-中华联合"),//食责（中华联合）
    CODE_24("201907260121", "19PR961660", "新实责（阳光）"),//新实责阳光
    CODE_25("201907260122", "19PR789827", "新校责（阳光）"), //新校责阳光
    CODE_26("20190805002", "19PR701524", "食品险（阳光）"), //新食品阳光
    CODE_27("201907310011", "19PR789827", "新实责(中华联合)"), //新实责中华联合
    CODE_28("201907310012", "19PR701524", "新实责(中华联合)"), //新校责中华联合
    CODE_29("20190516012", "19PR324941", "山东省校（园）方责任保险项目-临沂"), //山东临沂产品
    CODE_30("201908270011", "19PR961660", "新实责校责(国寿财)"), //新国寿财产品
    CODE_31("201908270012", "19PR789827", "新实责校责(国寿财)"), //新国寿财产品
    CODE_32("202007221132250", "20PR631267", "济南学平险获取支付地址"),//济南学平险获取支付地址
    CODE_33("202007231708310", "20PR631267", "济南学平险"),//济南学平险
    CODE_34("202008181443590", "20PR393968", "徐州学平险"),//徐州学平险
    CODE_35("202008041342390", "20PR806488", "广东省校（园）方责任保险"),//广东校责
    CODE_36("202008190924410", "20PR191668", "广东省校园食品安全责任保险"),//广东食品
    CODE_37("202008180929030", "20PR530654", "广东省教职员工校（园）方责任保险"),//广东教职工
    CODE_38("202008191339340", "20PR768517", "山西新学道"),//山西新学道
    CODE_39("202008190922090", "20PR485549", "广东省校车道路客运承运人责任保险"),//广东校车
    CODE_40("202008201400250", "20PR432987", "临沂市学生幼儿平安保险"),//临沂市学生幼儿平安保险
    CODE_41("202008271510580", "20PR785756", "河南学平险种(中华联合)"), //河南学平险获取支付地址
    CODE_42("202008271514410", "20PR785756", "河南学平险种(中华联合)"), //河南学平险回调出单接口
    CODE_43("202009090116140", "20PR810200", "济宁学平险"),//济宁学平险（线上）
    CODE_44("202009171037520", "20PR905151", "启东市学生平安保险示范项目"),//启东学平险
    CODE_45("20190909101", "19PR701524", "国寿财食品险"),//启东学平险
    CODE_46("202101201139110", "20PR888551", "诚泰云南我学保"),//诚泰云南我学保
    CODE_47("202101251532220", "20PR888551", "诚泰云南我学保获取支付地址")//诚泰云南我学保获取支付地址

    ;
    private String ifCode;
    private String proCode;
    private String desc;

    IssueEnum(String ifCode, String proCode, String desc) {
        this.ifCode = ifCode;
        this.proCode = proCode;
        this.desc = desc;
    }

    /**
     * 根据ifCode获取对应产品编码proCode
     *
     * @param ifCode
     * @return
     */
    public static String getProCodeByIfCode(String ifCode) {
        for (IssueEnum issueEnum : IssueEnum.values()) {
            if (issueEnum.ifCode.equals(ifCode)) {
                return issueEnum.proCode;
            }
        }
        return "";
    }

    /**
     * 根据ifCode获取对应产品编码名称
     *
     * @param ifCode
     * @return
     */
    public static String getProNameByIfCode(String ifCode) {
        for (IssueEnum issueEnum : IssueEnum.values()) {
            if (issueEnum.ifCode.equals(ifCode)) {
                return issueEnum.desc;
            }
        }
        return "";
    }

    /**
     * 通过ifCode获取对应枚举值
     *
     * @param ifCode
     * @return
     */
    public static IssueEnum getIssueEnum(String ifCode) {
        for (IssueEnum issueEnum : IssueEnum.values()) {
            if (issueEnum.ifCode.equals(ifCode)) {
                return issueEnum;
            }
        }
        return null;
    }

    /**
     * 通过iproCode获取对应枚举值
     *
     * @param proCode
     * @return
     */
    public static IssueEnum getIssueEnumByProCode(String proCode) {
        for (IssueEnum issueEnum : IssueEnum.values()) {
            if (issueEnum.proCode.equals(proCode)) {
                return issueEnum;
            }
        }
        return null;
    }

    /**
     * 根据proCode获取对应产品名称
     *
     * @param proCode
     * @return
     */
    public static String getProNameByProCode(String proCode) {
        for (IssueEnum issueEnum : IssueEnum.values()) {
            if (issueEnum.proCode.equals(proCode)) {
                return issueEnum.desc;
            }
        }
        return "";
    }

    //只有学责，阳光实责校责有电子发票
    public static List ynProCodeList() {
        List list = new ArrayList();
        //增加云南地区下载电子发票
        list.add(CODE_10.getProCode());
        list.add(CODE_11.getProCode());
        list.add(CODE_12.getProCode());
        list.add(CODE_13.getProCode());
        return list;
    }


    //只有学责，阳光实责校责有电子发票
    public static List addProCodeList() {
        List list = new ArrayList();
        list.add(CODE_2.getProCode());
        list.add(CODE_24.getProCode());
        list.add(CODE_25.getProCode());
        list.add(CODE_26.getProCode());
        //增加云南地区下载电子发票
        list.add(CODE_10.getProCode());
        list.add(CODE_11.getProCode());
        list.add(CODE_12.getProCode());
        list.add(CODE_13.getProCode());
        //增加广东地区下载电子发票
        list.add(CODE_35.getProCode());
        list.add(CODE_36.getProCode());
        list.add(CODE_37.getProCode());
        list.add(CODE_39.getProCode());
        return list;
    }

    public static void main(String[] args) throws Exception {
        //System.out.println(IssueEnum.getIfCodeByPreCode("19PR452292"));
    }

    public String getIfCode() {
        return ifCode;
    }

    public void setIfCode(String ifCode) {
        this.ifCode = ifCode;
    }

    public String getProCode() {
        return proCode;
    }

    public void setProCode(String proCode) {
        this.proCode = proCode;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
